<%@page import="modelo.Product"%>
<%@page import="java.util.List"%>
<%@page import="infraestructura.PersistenceManager"%>
<!DOCTYPE html>
<html>
    <head>
        <title></title>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <link rel="stylesheet" href="../css/admin.css" type="text/css" charset="utf-8"/>
    </head>
    <body>
        <div class="pagina">
            <%@include  file="cabecera.jsp" %>
            <div class="cuerpo">
                <%@ include file="buscador.jsp"%>
                <ul class="listaProductos contenedor">
                    <li><a href="agregarproducto.jsp" class="agregarProducto">Agregar producto</a></li>
                    <%  PersistenceManager manager = PersistenceManager.getPersistenceManager(getServletContext().getInitParameter("persistenceMethod"));
                        List<Product> products = manager.getALLTheProducts();                    
                        for (Product product : products) {
                    %>
                    <li><img src="../imgs/Productos/<%= product.getId()%>.jpg" class="imagenProducto"> <a href="modificarproducto.jsp?id=<%=product.getId()%>"><%= product.getName()%> </a>(<%= product.getPrice()%> )</li>
                    <li class="clear"> </li>
                    <% } %>
                    <div class="clear"></div>
                </ul>
            </div>

            <%@include  file="pie.jsp" %>

        </div>
    </body>
</html>